<?php
	/* Functions in this file */
	/**************************/

	// DoDeserialize(&$stream)
	// GetAlternateEnding($index)
	// GetAlternateEndingCount()
	// GetChordDiagram($index)
	// GetChordDiagramCount()
	// GetDynamic($index)
	// GetDynamicCount()
	// GetFloatingText($index)
	// GetFloatingTextCount()
	// GetGuitar($index)
	// GetGuitarCount()
	// GetGuitarIn($index)
	// GetGuitarInCount()
	// GetSystem($index)
	// GetSystemCount()
	// GetTempoMarker($index)
	// GetTempoMarkerCount()
	// IsValidAlternateEndingIndex($index)
	// IsValidChordDiagramIndex($index)
	// IsValidDynamicIndex($index)
	// IsValidFloatingTextIndex($index)
	// IsValidGuitarIndex($index)
	// IsValidGuitarInIndex($index)
	// IsValidSystemIndex($index)
	// IsValidTempoMarkerIndex($index)
	// Score()
?>
<?php
	 
	class Score {
		 
		 
		protected $m_guitarArray;
		protected $m_chordDiagramArray;
		public $m_floatingTextArray;
		protected $m_guitarInArray;
		protected $m_tempoMarkerArray;
		protected $m_dynamicArray;
		protected $m_alternateEndingArray;
		public $m_systemArray;
		 
		 
		 
		 
		function IsValidGuitarIndex($index) {
			return ($index < $this->GetGuitarCount());
		}
		 
		 
		function GetGuitarCount() {
			return sizeof($this->m_guitarArray);
		}
		 
		 
		 
		function GetGuitar($index) {
			if (!$this->IsValidGuitarIndex($index)) return NULL; return ($this->m_guitarArray[$index]);
		}
		 
		// Chord Diagram Functions
		 
		 
		 
		function IsValidChordDiagramIndex($index) {
			return ($index < $this->GetChordDiagramCount());
		}
		 
		 
		function GetChordDiagramCount() {
			return sizeof($this->m_chordDiagramArray);
		}
		 
		 
		 
		function GetChordDiagram($index) {
			if (!$this->IsValidChordDiagramIndex($index)) return NULL; return ($this->m_chordDiagramArray[$index]);
		}
		 
		// Floating Text Functions
		 
		 
		 
		function IsValidFloatingTextIndex($index) {
			return ($index < $this->GetFloatingTextCount());
		}
		 
		 
		function GetFloatingTextCount() {
			return sizeof($this->m_floatingTextArray);
		}
		 
		 
		 
		function GetFloatingText($index) {
			if (!$this->IsValidFloatingTextIndex($index)) return NULL;
			 return ($this->m_floatingTextArray[$index]);
		}
		 
		// Guitar In Functions
		 
		 
		 
		function IsValidGuitarInIndex($index) {
			return ($index < $this->GetGuitarInCount());
		}
		 
		 
		function GetGuitarInCount() {
			return sizeof($this->m_guitarInArray);
		}
		 
		 
		 
		function GetGuitarIn($index) {
			if (!$this->IsValidGuitarInIndex($index)) return NULL;
			 return ($this->m_guitarInArray[$index]);
		}
		 
		// Tempo Marker Functions
		 
		 
		 
		function IsValidTempoMarkerIndex($index) {
			return ($index < $this->GetTempoMarkerCount());
		}
		 
		 
		function GetTempoMarkerCount() {
			return sizeof($this->m_tempoMarkerArray);
		}
		 
		 
		 
		function GetTempoMarker($index) {
			if (!$this->IsValidTempoMarkerIndex($index)) return NULL;
			 return ($this->m_tempoMarkerArray[$index]);
		}
		 
		// Dynamic Functions
		 
		 
		 
		function IsValidDynamicIndex($index) {
			return ($index < $this->GetDynamicCount());
		}
		 
		 
		function GetDynamicCount() {
			return sizeof($this->m_dynamicArray);
		}
		 
		 
		 
		function GetDynamic($index) {
			if (!$this->IsValidDynamicIndex($index)) return NULL;
			 return ($this->m_dynamicArray[$index]);
		}
		 
		// Alternate Ending Functions
		 
		 
		 
		function IsValidAlternateEndingIndex($index) {
			return ($index < $this->GetAlternateEndingCount());
		}
		 
		 
		function GetAlternateEndingCount() {
			return sizeof($this->m_alternateEndingArray);
		}
		 
		 
		 
		function GetAlternateEnding($index) {
			if (!$this->IsValidAlternateEndingIndex($index)) return NULL;
			 return ($this->m_alternateEndingArray[$index]);
		}
		 
		// System Functions
		 
		 
		 
		function IsValidSystemIndex($index) {
			return ($index < $this->GetSystemCount());
		}
		 
		 
		function GetSystemCount() {
			return sizeof($this->m_systemArray);
		}
		 
		 
		 
		function GetSystem($index) {
			if (!$this->IsValidSystemIndex($index)) return NULL;
			 return ($this->m_systemArray[$index]);
		}
		 
		 
		 
		 
		 
		function Score() {
			
			/*
			$m_chordDiagramArray;
			$m_floatingTextArray;
			*/
			$this->m_guitarArray[0] = new Guitar();
			$this->m_guitarInArray[0] = new GuitarIn();
			/*
			$m_tempoMarkerArray;
			$m_dynamicArray;
			$m_alternateEndingArray;
			*/
			$this->m_systemArray[0] = new System();
			 
			 
		}
		 
		
		// Serialization Functions
		 
		 
		 
		function DoSerialize(&$stream){
		 
			$arr = new PowerTabArray ();
			$arr->Serialize($stream,$this->m_guitarArray);

			$arr = new PowerTabArray ();
			$arr->Serialize($stream,$this->m_chordDiagramArray);

			$arr = new PowerTabArray ();
			$arr->Serialize($stream,$this->m_floatingTextArray);

			$arr = new PowerTabArray ();
			$arr->Serialize($stream,$this->m_guitarInArray);

			$arr = new PowerTabArray ();
			$arr->Serialize($stream,$this->m_tempoMarkerArray);

			$arr = new PowerTabArray ();
			$arr->Serialize($stream,$this->m_dynamicArray);

			$arr = new PowerTabArray ();
			$arr->Serialize($stream,$this->m_alternateEndingArray);

			$arr = new PowerTabArray ();
			$arr->Serialize($stream,$this->m_systemArray);
			
			unset ($arr);


			return 1;
		}
		 
		 
		 
		function DoDeserialize(&$stream) {
			 
			$arr = new PowerTabArray ();
			$this->m_guitarArray = $arr->DeSerialize($stream , new Guitar());
			 
			$arr = new PowerTabArray ();
			$this->m_chordDiagramArray = $arr->DeSerialize($stream , new ChordDiagram());
			 
			$arr = new PowerTabArray ();
			$this->m_floatingTextArray = $arr->DeSerialize($stream , new FloatingText());
			 
			$arr = new PowerTabArray ();
			$this->m_guitarInArray = $arr->DeSerialize($stream , new GuitarIn());
			 
			$arr = new PowerTabArray ();
			$this->m_tempoMarkerArray = $arr->DeSerialize($stream , new TempoMarker());
			 
			$arr = new PowerTabArray ();
			$this->m_dynamicArray = $arr->DeSerialize($stream , new Dynamic());
			 
			$arr = new PowerTabArray ();
			$this->m_alternateEndingArray = $arr->DeSerialize($stream , new AlternateEnding());
			 
			$arr = new PowerTabArray ();
			$this->m_systemArray = $arr->DeSerialize($stream , new System());
			
			unset ($arr);
			 
			 
		}
		 
		 
	}
	 
?>

